package graph.entities;

import static ogl.vecmathimp.FactoryDefault.vecmath;
import graph.Entity;
import graph.Part;
import ogl.vecmath.Matrix;
import ogl.vecmathimp.MatrixImp;

public class Scale extends Entity {

	public Scale(Part p) {
		super(p);
	}
	
	@Override
	public void simulate(EntityType et, float elapsed) {
		Matrix scaleMatrix = vecmath.scaleMatrix(1, 1, 1);
		if (et == EntityType.ScaleMinus) {
			scaleMatrix = vecmath.scaleMatrix(0.9f, 0.9f, 0.9f);
		}
		if (et == EntityType.ScalePlus) {
			scaleMatrix = vecmath.scaleMatrix(1.1f, 1.1f, 1.1f);
		}
		MatrixImp modelMatrix = super.getPart().getMatrix();
		modelMatrix = (MatrixImp) modelMatrix.mult(scaleMatrix);
		this.getPart().setMatrix(modelMatrix);
	}

}
